import 'dart:typed_data';
import '../../../../library.dart';
import '../../../base/message/private_instruction_message_base.dart';

// Huari指令
abstract class HuariPrivateIntructionMessage<B extends HuariPrivateRequestBody>
    extends PrivateInstructionMessageBase<HuariMessage> {
  // 私有请求体
  B get privateRequestBody;

  @override
  HuariMessage getAuthRandomCodeIntrMsg(Uint8List identifyBytes) =>
      HuariMessage.from(privateRequestBody.getAuthRandomCode(identifyBytes));

  @override
  HuariMessage verifyAuthRandomCodeIntrMsg(Uint8List bytes) =>
      HuariMessage.from(privateRequestBody.verifyAuthRandomCode(bytes));

  @override
  HuariMessage lockIntrMsg(Uint8List identifyBytes, bool status) =>
      HuariMessage.from(privateRequestBody.lock(identifyBytes, status));

  @override
  HuariMessage writeProductModelIntrMsg(Uint8List model) {
    return HuariMessage.from(privateRequestBody.writeProductModel(model));
  }

  @override
  HuariMessage writeActivationTimeIntrMsg(Uint8List time) {
    return HuariMessage.from(privateRequestBody.writeActiveTime(time));
  }

  @override
  HuariMessage getSnIntrMsg() {
    return HuariMessage.from(privateRequestBody.getSN);
  }

  @override
  HuariMessage getProductModelIntrMsg() {
    return HuariMessage.from(privateRequestBody.getProductModel);
  }

  @override
  HuariMessage setRideModeIntrMsg(int mode) {
    return HuariMessage.from(privateRequestBody.setRideMode(mode));
  }

  @override
  HuariMessage setRtcTimeIntrMsg(DateTime time) => throw UnimplementedError();

  @override
  HuariMessage setStandbyTimeIntrMsg(int duration) =>
      throw UnimplementedError();

  @override
  HuariMessage enablePeriodicDataSwitchIntrMsg(bool enable) {
    return HuariMessage.from(
        privateRequestBody.enablePeriodicDataSwitch(enable));
  }

  // 读取控制器曲线
  HuariMessage getControllerDataIntrMsg(Uint8List addrBytes) {
    return HuariMessage.from(privateRequestBody.getControllerData(addrBytes));
  }

  // 设置控制器曲线
  HuariMessage setControllerDataIntrMsg(
      Uint8List addrBytes, Uint8List dataBytes) {
    return HuariMessage.from(
        privateRequestBody.setControllerData(addrBytes, dataBytes));
  }

  @override
  HuariMessage addMasterKeyIntrMsg(Uint8List bytes) {
    return HuariMessage.from(privateRequestBody.addMasterKey(bytes));
  }

  @override
  HuariMessage deleteMasterKeyIntrMsg(Uint8List bytes) {
    return HuariMessage.from(privateRequestBody.deleteMasterKey(bytes));
  }

  @override
  HuariMessage addSubKeyIntrMsg(Uint8List bytes) {
    return HuariMessage.from(privateRequestBody.addSubKey(bytes));
  }

  @override
  HuariMessage deleteSubKeyIntrMsg(Uint8List bytes) {
    return HuariMessage.from(privateRequestBody.deleteSubKey(bytes));
  }

  @override
  HuariMessage getKeyListIntrMsg(Uint8List bytes) {
    return HuariMessage.from(privateRequestBody.getKeyList(bytes));
  }

  @override
  HuariMessage deleteNfcCardIntrMsg() {
    return HuariMessage.from(privateRequestBody.deleteNfcCard());
  }

  @override
  HuariMessage enterNfcCardModeIntrMsg() {
    return HuariMessage.from(privateRequestBody.enterNfcCardMode());
  }

  @override
  HuariMessage exitNfcCardModeIntrMsg() {
    return HuariMessage.from(privateRequestBody.exitNfcCardMode());
  }

  @override
  HuariMessage setSpeedLimitIntrMsg(int speed) => throw UnimplementedError();

  @override
  HuariMessage setWarningSpeedIntrMsg(int speed) => throw UnimplementedError();

  @override
  HuariMessage setRideAssistSwitchIntrMsg(bool enable) =>
      throw UnimplementedError();

  @override
  HuariMessage setAccAndBrakeAssistPercentageIntrMsg(
          {required int accPercentage, required int brakePercentage}) =>
      throw UnimplementedError();

  @override
  HuariMessage setPedalSensitivityIntrMsg(int sensitivity1, int sensitivity2) =>
      throw UnimplementedError();

  @override
  HuariMessage setBalanceAngleIntrMsg(int angle) => throw UnimplementedError();

  @override
  HuariMessage setBermAngleModeSwitchIntrMsg(bool enable) =>
      throw UnimplementedError();

  @override
  HuariMessage setSpinKillSwitchIntrMsg(bool enable) =>
      throw UnimplementedError();

  @override
  HuariMessage setMainSoundSwitchIntrMsg(bool enable) =>
      throw UnimplementedError();

  @override
  HuariMessage setVoiceSwitchIntrMsg(bool enable) => throw UnimplementedError();

  @override
  HuariMessage setVolumeIntrMsg(int volume) => throw UnimplementedError();

  @override
  HuariMessage setTBoxLowBatteryWakeupSwitchIntrMsg(bool enable) =>
      throw UnimplementedError();

  @override
  HuariMessage setTBoxRebootIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage setTransportModeSwitchIntrMsg(bool enable) =>
      throw UnimplementedError();

  @override
  HuariMessage triggerVehicleCalibrationIntrMsg(
          {bool? gyroCalibrationEnabled,
          bool? pitchCalibrationEnabled,
          bool? rollCalibrationEnabled}) =>
      throw UnimplementedError();

  @override
  HuariMessage setLoadDetectionIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage setNoLoadDetectionIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage setAutoHeadlightModeSwitchIntrMsg(bool enable) =>
      throw UnimplementedError();

  @override
  HuariMessage setTurnSignalIntrMsg(bool leftSignal, bool rightSignal) =>
      throw UnimplementedError();

  @override
  HuariMessage setLowBatteryRideSwitchIntrMsg(bool enable) =>
      throw UnimplementedError();

  @override
  HuariMessage setDisplayAutoOffSwitchIntrMsg(bool enable) =>
      throw UnimplementedError();

  @override
  HuariMessage setLogoLightBrightnessIntrMsg(int brightness) =>
      throw UnimplementedError();

  @override
  HuariMessage setDaytimeRunningLightSwitchIntrMsg(bool enable) =>
      throw UnimplementedError();

  @override
  HuariMessage setDisplayEnterUpgradeStatusIntrMsg(bool enable) =>
      throw UnimplementedError();

  @override
  HuariMessage setDisplayEnterFileTransferStatusIntrMsg(bool enable) =>
      throw UnimplementedError();

  @override
  HuariMessage playSoundIntrMsg(int audioIndex, {bool? play = true}) =>
      throw UnimplementedError();

  @override
  HuariMessage setPeriodicDataReportingIntervalIntrMsg(int interval) {
    throw UnimplementedError();
  }

  @override
  HuariMessage getRealtimeAllIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage getRealtimeBatteryInfoIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage getRealtimeErrorIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage getRealtimeStatusIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage getSettingsAllIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage getStatisticOnceIntrMsg({int? startNum, int? count}) =>
      throw UnimplementedError();

  @override
  HuariMessage getStatisticsTotalIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage getRealtimeInfoIntrMsg() => throw UnimplementedError();

  // 获取综合产品信息
  @override
  HuariMessage getIntegratedProductInfoIntrMsg() => throw UnimplementedError();

  // 获取综合实时信息
  @override
  HuariMessage getIntegratedRealtimeInfoAllIntrMsg() =>
      throw UnimplementedError();

  @override
  HuariMessage hornIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage lightIntrMsg({required bool lowBeam, required bool highBeam}) {
    throw UnimplementedError();
  }

  @override
  HuariMessage setVehicleNicknameIntrMsg(Uint8List bytes) {
    throw UnimplementedError();
  }

  @override
  HuariMessage setVehiclePasswordIntrMsg(Uint8List bytes) {
    throw UnimplementedError();
  }

  @override
  HuariMessage getVehicleNicknameIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage getVehiclePasswordIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage getTirePressureSensorInfoIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage setTirePressureLowAlarmThresholdIntrMsg(int threshold) {
    throw UnimplementedError();
  }

  @override
  HuariMessage setTBoxScreenInfoDisplaySwitchIntrMsg(bool enable) {
    throw UnimplementedError();
  }

  @override
  HuariMessage clearMotorAdaptationDataIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage getMotorAdaptationStatusIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage startBatteryVoltageCalibrationIntrMsg({bool? write = true}) {
    throw UnimplementedError();
  }

  @override
  HuariMessage startMotorAdaptationIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage startMotorSelfCheckIntrMsg({int? method = 1}) {
    throw UnimplementedError();
  }

  @override
  HuariMessage stopMotorAdaptationIntrMsg() => throw UnimplementedError();

  @override
  HuariMessage clearSearchedTirePressureSensorInfoIntrMsg() =>
      throw UnimplementedError();
}
